﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.ComponentModel;

namespace UnfriendlyFire.Controllers
{
    class ScenarioModelBinder : DefaultModelBinder
    {
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            return base.BindModel(controllerContext, bindingContext);
        }

        protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)
        {
            if (propertyDescriptor.Name.Equals("SiteParameters"))
            {
                ValueProviderResult result = bindingContext.ValueProvider.GetValue("SiteParameters[0].Name");
            }
            else if (propertyDescriptor.Name.Equals("ArmedForceParameters"))
            {
                ValueProviderResult result = bindingContext.ValueProvider.GetValue("ArmedForceParameters[0].Name");
            }
            else
            {
                base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
            }
        }
    }
}
